package main

import "fmt"

// 获取最大值
func getMax(a int, b int) (max int) {
	if a >= b {
		max = a
		return
	}
	max = b
	return
}

// 返回最大值和最小值
func getMaxAndMin(a int, b int) (max int, min int) {
	if a > b {
		max = a
		min = b
	} else {
		max = b
		min = a
	}
	return
}

func print1() {
	fmt.Println("hello")
}
func print2() {
	fmt.Println("world")
}

func main() {
	var a, b int = 30, 20
	fmt.Printf("max of %d and %d is %d\n", a, b, getMax(a, b))

	var max, min = getMaxAndMin(a, b)

	fmt.Printf("max of %d and %d is %d,min is %d\n", a, b, max, min)
	// 匿名函数丢弃变量
	var max2, _ = getMaxAndMin(a, b)
	fmt.Printf("max of %d and %d is %d\n", a, b, max2)

	go print1()
	go print2()
}
